import request from '@/utils/request'
// 预警信息 API接口
const cre_warningApi = {
    list: '/cre_warning/list',
    save: '/cre_warning/save',
    view: '/cre_warning/view',
    del: '/cre_warning/delete',
    dels: '/cre_warning/batchDel',
    output: '/cre_warning/output',
    exportExcelTemplate: '/cre_warning/exportExcelTemplate',
    importExcel: '/cre_warning/importExcel',
    queryList: '/cre_warning/queryList'
}

/**
 * 查询预警处置任务关联查询预警信息数据
 */
 export function queryList(pageinfo) {
    return request({
        url: cre_warningApi.queryList,
        method: 'post',
        data: pageinfo
    })
}

/**
 * 导入预警信息Excel
 */
export function importExcel(data) {
  var body = new FormData()
  body.append("file", data);
  return request({
    url: cre_warningApi.importExcel,
    headers: {"Content-Type": "multipart/form-data"},
    method: 'post',
    data: body
  })
}

/**
 * 导出预警信息Excel模板
 */
export function exportExcelTemplate () {
    return request({
        url: cre_warningApi.exportExcelTemplate,
        method: 'post',
        responseType: 'blob'
    })
}

/**
 * 导出预警信息
 */
export function output (data) {
    return request({
        url: cre_warningApi.output,
        method: 'post',
        data: data ,
        responseType: 'blob'
    })
}
/**
 * 批量删除预警信息
 * @param {*} ids
 */
export function delCre_warnings (ids) {
    return request({
        url: cre_warningApi.dels,
        method: 'post',
        params: {ids}
    })
}
/**
 * 删除预警信息
 * @param {*} id
 */
export function delCre_warning (id) {
    return request({
        url: cre_warningApi.del,
        method: 'post',
        params: {id}
    })
}
/**
 * 查看、编辑预警信息
 * @param {*} id
 */
export function viewCre_warning (id) {
    return request({
        url: cre_warningApi.view,
        method: 'get',
        params: {id}
    })
}
/**
 * 保存预警信息
 * @param {*} body
 */
export function saveCre_warning (body) {
    return request({
        url: cre_warningApi.save,
        method: 'post',
        data: body
    })
}
/**
 * 查询预警信息列表
 * @param {*} body
 */
export function queryCre_warningList (body) {
    return request({
        url: cre_warningApi.list,
        method: 'post',
        data: body
    })
}